import React from 'react'
import { FlatList } from 'react-native'
import { ContactItem } from './contact-item'

export const Contacts = ({ contacts, loading, onRefresh }) => (
  <FlatList
    data={contacts}
    refreshing={loading}
    onRefresh={onRefresh}
    keyExtractor={x => x.id}
    renderItem={({ item }) => <ContactItem contact={item} />}
  />
)
